home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
shrlk201.zip
/
_SETUP.1
/
Main.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-07-22
|
2KB
|
84 lines
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Spin;
const
DLLName = 'KeyGen.DLL';
type
TfrmUnlockGenerator = class(TForm)
txtUserName: TEdit;
txtPrivateKey: TEdit;
lblUserName: TLabel;
lblPrivateKey: TLabel;
seExtension: TSpinEdit;
rgUnlockType: TRadioGroup;
lblExtensionLength: TLabel;
btnGenerateKey: TButton;
Bevel1: TBevel;
txtCodeOut: TEdit;
lblCode: TLabel;
procedure seExtensionChange(Sender: TObject);
procedure btnGenerateKeyClick(Sender: TObject);
procedure rgUnlockTypeClick(Sender: TObject);
procedure txtUserNameChange(Sender: TObject);
procedure txtPrivateKeyChange(Sender: TObject);
private
public
end;
function GenerateKey(sName, sPrivateKey: pchar; iExtension: integer): pchar; stdcall; external DLLName name 'GenerateKey';
var
frmUnlockGenerator: TfrmUnlockGenerator;
implementation
{$R *.DFM}
procedure TfrmUnlockGenerator.seExtensionChange(Sender: TObject);
begin
if seExtension.Value = 0 then rgUnlockType.ItemIndex := 0
else rgUnlockType.ItemIndex := 1;
txtCodeOut.Text := '';
end;
procedure TfrmUnlockGenerator.btnGenerateKeyClick(Sender: TObject);
begin
txtCodeOut.Text := GenerateKey(pchar(txtUserName.Text), pchar(txtPrivateKey.Text), seExtension.Value);
end;
///////////////////////////////////////////////////////////
procedure TfrmUnlockGenerator.rgUnlockTypeClick(Sender: TObject);
begin
if rgUnlockType.ItemIndex = 0 then
begin
seExtension.Enabled := False;
seExtension.Value := 0;
lblExtensionLength.Enabled := False;
end
else
begin
seExtension.Enabled := True;
lblExtensionLength.Enabled := True;
end;
end;
procedure TfrmUnlockGenerator.txtUserNameChange(Sender: TObject);
begin
txtCodeOut.Text := '';
end;
procedure TfrmUnlockGenerator.txtPrivateKeyChange(Sender: TObject);
begin
txtCodeOut.Text := '';
end;
end.